package com.szh.zx.gaoDingJavaBook.yitu.one;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;

public class anno {
	public static void main(String[] args) {
		ArrayList<Integer> integers = new ArrayList<>();
		integers.add(12);
		integers.add(12);
		integers.add(12);
		integers.add(12);

		 //IllegalStateException
		for (Iterator<Integer> iterator =integers.iterator(); iterator.hasNext();){
			Integer integer = iterator.next();
			if (integer>1){
				iterator.remove();
			}
			if (integer>1){ // 此时是true 进入if ，但是元素已经被删除了
				iterator.remove();
			}
		}


		System.out.println(integers);
	}
}

class Student12 {
	String name;

	public Student12(String name) {
		this.name = name;
	}
}

class Teacher extends Student12 {
	public Teacher(String name) {
		super(name);
	}
}
